﻿using System;
using System.Collections.Generic;
using System.Text;
using Common;
using LoginServer.Converter;

namespace LoginServer
{
    public partial class ManagerMachine
    {
        void Process_L_CreateTable_OK(object[] param)
        {
            MachineConnection machine = loginServer.convert_data.GetMachine(param);                       
            List<byte> IPAndPort = new List<byte>();
            int UserID=0;
            int TableID=0;
            loginServer.convert_data.ConvertReceive_L_CreateTableOK(ref UserID, ref TableID, ref IPAndPort,param);
            loginServer.CreatTableOK(UserID, TableID, machine.Machine_ID,IPAndPort.ToArray());
        }
        void Process_L_JoinTable_OK(object[] param)
        {
            MachineConnection machine = loginServer.convert_data.GetMachine(param);
            List<byte> IPAndPort = new List<byte>();
            int UserIDJoin = 0;
            int TableIDJoin = 0;
            loginServer.convert_data.ConvertReceive_L_JoinTableOK(ref UserIDJoin,ref TableIDJoin,ref IPAndPort,param);
            loginServer.JoinTableOK(UserIDJoin, TableIDJoin, machine.Machine_ID, IPAndPort.ToArray());
        }
        void Process_L_CreateRoom_OK(object[] param)
        {
            MachineConnection machine = loginServer.convert_data.GetMachine(param);
            int UserID = 0;
            int RoomID = 0;
            string RoomName = null;
            loginServer.convert_data.ConvertReceive_L_CreateRoomOK(ref UserID, ref RoomID, ref RoomName, param);
            loginServer.CreateRoomOK(UserID, RoomID, machine.Machine_ID, RoomName);
        }
        void Process_L_JoinRoom_OK(object[] param)
        {
            MachineConnection machine = loginServer.convert_data.GetMachine(param);
            int UserJoinID = 0;
            int RoomJoinID = 0;
            loginServer.convert_data.ConvertReceive_L_JoinRoomOK(ref UserJoinID, ref RoomJoinID, param);
            loginServer.JoinRoomOK(UserJoinID, RoomJoinID, machine.Machine_ID);
        }

    }
}
